home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / BM192A.ZIP / IO.S < prev    next >
Encoding:
Text File  |  1996-02-23  |  21.3 KB  |  851 lines

  1. *=======================================================*
  2. *    IO routines: latest update 23/02/96        *
  3. *=======================================================*
  4. *    Handle all WAD related processes        *
  5. *=======================================================*
  6.  
  7.     include        include\wad_tab.s
  8.  
  9. *-------------------------------------------------------*
  10. *    Read details from IWAD                *
  11. *-------------------------------------------------------*
  12. parse_iwad:
  13. *-------------------------------------------------------*
  14.     Cconws        #ascii_startup
  15.     bsr        open_wad
  16.     tst.w        d0
  17.     bmi        err_openwad
  18. .wad_check:
  19.     lea        wad_header,a5
  20.     Fread        wad_handle,#wh_len,a5
  21.     move.l        wh_sig(a5),d0
  22.     cmp.l        #'IWAD',d0
  23.     beq.s        .sig_valid
  24.     cmp.l        #'PWAD',d0
  25.     bne        err_badwad
  26. .sig_valid:
  27.     move.l        d0,wad_signature
  28.     Cconws        #ascii_format
  29.     Cconws        #wad_signature
  30.     imov.l        wh_entries(a5),d1
  31.     move.l        d1,wad_entries
  32.     tst.l        d1
  33.     beq        err_badwad
  34.     imov.l        wh_directory(a5),wad_diroffset
  35.     Cconws        #ascii_entries
  36.     move.l        wad_entries,d0
  37.     moveq        #0,d1
  38.     bsr        output_decimal
  39.     Cconws        #ascii_parsing
  40.     Fseek        wad_diroffset,wad_handle,#0
  41.     bsr        wad_readall
  42.     rts    
  43.  
  44. *-------------------------------------------------------*
  45. *    Read all WAD directory entries            *
  46. *-------------------------------------------------------*
  47. wad_readall:
  48. *-------------------------------------------------------*
  49.     move.l        wad_entries,d0
  50.     mulu.l        #wd_len,d0
  51.     move.l        d0,d7
  52.     Malloc        d0
  53.     tst.l        d0
  54.     ble        err_memory
  55.     move.l        d0,wad_directory
  56.     Fread        wad_handle,d7,d0
  57. .reformat_directory:
  58.     move.l        wad_directory,a0
  59.     move.l        wad_entries,d7
  60. .reformat_next:
  61.     imov.l        wd_offset(a0),wd_offset(a0)
  62.     imov.l        wd_size(a0),wd_size(a0)
  63.     lea        wd_len(a0),a0
  64.     subq.l        #1,d7
  65.     bne.s        .reformat_next
  66.     rts
  67.     
  68. *-------------------------------------------------------*
  69. *    Load & format all level-critical information    *
  70. *-------------------------------------------------------*
  71. load_leveldata:
  72. *-------------------------------------------------------*
  73.     move.l        wad_directory,wad_mdirectory
  74.     move.l        wad_entries,wad_mentries    
  75.     lea        levelmarker,a0
  76.     cmp.l        #-1,(a0)
  77.     beq.s        .use_default
  78.     bsr        place_marker
  79.     tst.l        d0
  80.     beq        err_missing
  81.     push.l        a0
  82.     move.l        a0,d7
  83.     Cconws        #ascii_levelmark
  84.     Cconws        d7
  85.     Cconws        #ascii_newline
  86.     pop.l        a0    
  87. .use_default:
  88.     bsr        init_fields
  89.     move.l        wad_mentries,d7
  90.     beq        err_fields
  91.     cmp.l        #32,d7
  92.     bmi.s        .clip_search
  93.     moveq        #32,d7
  94. .clip_search:
  95.     move.l        wad_mdirectory,a1
  96.     move.w        #field_count,fields_left
  97. .next_entry:
  98.     tst.w        fields_left
  99.     beq.s        .fields_done
  100.     lea        wd_name(a1),a0
  101.     bsr        check_fields
  102.     lea        wd_len(a1),a1
  103.     subq.l        #1,d7
  104.     bne.s        .next_entry
  105.     tst.w        fields_left
  106.     beq.s        .fields_done
  107.     bra        err_fields
  108. .fields_done:
  109.     bsr        measure_linedefs
  110.     Cconws        #ascii_parsingdone
  111.     rts
  112.  
  113. *-------------------------------------------------------*
  114. *    Calculate length of all walls for mapping    *    
  115. *-------------------------------------------------------*
  116. measure_linedefs:
  117. *-------------------------------------------------------*
  118.     move.l        Seg_Array,a0
  119.     move.l        Vertex_Array,a1
  120.     move.l        Line_Array,a2
  121.     move.w        NumSegs,d0
  122.     bra.s        .go
  123. .lp:    moveq        #0,d1
  124.     move.w        seg_from(a0),d1
  125.     moveq        #0,d2
  126.     move.w        seg_to(a0),d2
  127.     move.w        vtx_x(a1,d1.l*4),d3
  128.     move.w        vtx_y(a1,d1.l*4),d4
  129.     move.w        vtx_x(a1,d2.l*4),d5
  130.     move.w        vtx_y(a1,d2.l*4),d6
  131.     sub.w        d3,d5
  132.     sub.w        d4,d6
  133.     muls.w        d5,d5
  134.     muls.w        d6,d6
  135.     add.l        d5,d6
  136.     bsr        square_root
  137.     move.w        d7,seg_bam(a0)        ; temporarily use BAM field for length
  138.     lea        seg_len(a0),a0
  139. .go:    dbra        d0,.lp
  140.     rts
  141.  
  142. *-------------------------------------------------------*
  143. *    Simple subdivisional 32-bit sqrt routine    *
  144. *-------------------------------------------------------*
  145. square_root:
  146. *-------------------------------------------------------*
  147.     tst.l        d6
  148.     bpl.s        .pos
  149.     neg.l        d6
  150. .pos:    move.l        #1<<(16-1),d7
  151.     move.l        #1<<(16-2),d5
  152. .loop:    move.w        d7,d4
  153.     mulu.w        d4,d4
  154.     cmp.l        d6,d4
  155.     bgt.s        .sub
  156.     blt.s        .add
  157. .done:    rts
  158. .add:    add.l        d5,d7
  159.     lsr.l        d5
  160.     bne.s        .loop
  161.     bra.s        .done
  162. .sub:    sub.l        d5,d7
  163.     lsr.l        d5
  164.     bne.s        .loop
  165.     bra.s        .done
  166.  
  167.  
  168. *-------------------------------------------------------*
  169. *    Set up all leveldata search fields        *
  170. *-------------------------------------------------------*
  171. init_fields:
  172. *-------------------------------------------------------*
  173.     lea        level_fieldlist,a0
  174.     lea        level_fields,a1
  175.     moveq        #field_count-1,d2
  176. .next:    move.l        field_ascii(a0),(a1)+
  177.     lea        field_len(a0),a0
  178.     dbra        d2,.next
  179.     move.l        #-1,(a1)
  180.     rts
  181.  
  182. *-------------------------------------------------------*
  183. *    Hunt down and load each level resource        *
  184. *-------------------------------------------------------*
  185. check_fields:
  186. *-------------------------------------------------------*
  187.     lea        level_fields,a6
  188.     lea        level_fieldlist-field_len,a5
  189. .next:    lea        field_len(a5),a5
  190.     move.l        (a6)+,d0
  191.     bmi        .check_done
  192.     beq.s        .next
  193.     move.l        d0,a2
  194.     move.l        a0,a3
  195. .cmpl:    move.b        (a2)+,d2
  196.     beq.s        .same
  197.     fixcase        d2
  198.     move.b        (a3)+,d3
  199.     fixcase        d3
  200.     cmp.b        d2,d3
  201.     beq.s        .cmpl
  202. .diff:    bra.s        .next
  203. .same:    pushall
  204.     move.l        a1,a4
  205.     move.l        d0,d7
  206.     Cconws        #ascii_reading
  207.     Cconws        d7
  208.     Cconws        #ascii_wipe
  209.     move.l        wd_size(a4),d0
  210.     addq.l        #3,d0
  211.     and.b        #-4,d0
  212.     Malloc        d0
  213.     tst.l        d0
  214.     ble        .err_memory
  215.     move.l        d0,field_ptr
  216.     Fseek        wd_offset(a4),wad_handle,#0
  217.     Fread        wad_handle,wd_size(a4),field_ptr
  218.     tst.l        d0
  219.     bmi        .err_truncated        
  220.     move.l        field_module(a5),a2
  221.     move.l        wd_size(a4),d0
  222.     move.l        field_ptr,a0
  223.     jsr        (a2)
  224.     popall
  225.     subq.w        #1,fields_left
  226.     clr.l        -4(a6)
  227. .check_done:
  228.     rts
  229. .err_memory:
  230.     popall
  231.     bra        err_memory
  232. .err_truncated:
  233.     popall
  234.     bra        err_truncated
  235.     
  236. *-------------------------------------------------------*
  237. *    Place search-marker in WAD directory        *
  238. *-------------------------------------------------------*
  239. place_marker:
  240. *-------------------------------------------------------*
  241.     move.l        a0,wad_searchfield
  242.     move.l        wad_directory,a1
  243.     move.l        wad_entries,d1
  244. .search_next:
  245.     lea        wd_name(a1),a2
  246.     move.l        a0,a3
  247.     moveq        #8-1,d4
  248. .search_look:
  249.     move.b        (a3)+,d2
  250.     beq.s        .search_stop
  251.     fixcase        d2
  252.     move.b        (a2)+,d3
  253.     fixcase        d3
  254.     cmp.b        d2,d3    
  255.     bne.s        .search_diff
  256.     dbra        d4,.search_look
  257.     bra.s        .search_over
  258. .search_diff:    
  259.     lea        wd_len(a1),a1
  260.     subq.l        #1,d1
  261.     bne.s        .search_next
  262. .search_fail:
  263.     moveq        #0,d0
  264.     bra.s        .search_exit
  265. .search_stop:
  266.     tst.b        (a2)+
  267.     bne.s        .search_diff
  268. .search_over:
  269.     move.l        a1,wad_mdirectory
  270.     move.l        d1,wad_mentries
  271.     moveq        #1,d0
  272. .search_exit:
  273.     rts
  274.  
  275. *-------------------------------------------------------*
  276. *    Find & load any resource from WAD        *
  277. *-------------------------------------------------------*
  278. load_resource:
  279. *-------------------------------------------------------*
  280.     move.l        a0,wad_searchfield
  281.     move.l        wad_directory,a1
  282.     move.l        wad_entries,d1
  283. .search_next:
  284.     lea        wd_name(a1),a2
  285.     move.l        a0,a3
  286.     moveq        #8-1,d4
  287. .search_look:
  288.     move.b        (a3)+,d2
  289.     beq.s        .search_stop
  290.     fixcase        d2
  291.     move.b        (a2)+,d3
  292.     fixcase        d3
  293.     cmp.b        d2,d3    
  294.     bne.s        .search_diff
  295.     dbra        d4,.search_look
  296.     bra.s        .search_over
  297. .search_diff:    
  298.     lea        wd_len(a1),a1
  299.     subq.l        #1,d1
  300.     bne.s        .search_next
  301. .search_fail:
  302.     moveq        #0,d0
  303.     bra        .search_exit
  304. .search_stop:
  305.     tst.b        (a2)+
  306.     bne.s        .search_diff
  307. .search_over:
  308.     move.l        a1,wad_mdirectory
  309.     move.l        wd_size(a1),d6
  310.     Malloc        d6
  311.     tst.l        d0
  312.     ble.s        .search_fail
  313.     move.l        d0,a6
  314.     move.l        a1,a4
  315.     pushall
  316.     Fseek        wd_offset(a4),wad_handle,#0
  317.     Fread        wad_handle,wd_size(a4),a6
  318.     popall
  319.     moveq        #1,d0
  320. .search_exit:
  321.     rts
  322.  
  323. *-------------------------------------------------------*
  324. *    Direct-access version of load_resource        *
  325. *-------------------------------------------------------*
  326. read_resource:
  327. *-------------------------------------------------------*
  328.     pushall
  329.     move.l        a0,a4
  330.     move.l        a1,a6
  331.     move.l        wd_size(a4),d6
  332.     Fseek        wd_offset(a4),wad_handle,#0
  333.     Fread        wad_handle,wd_size(a4),a6
  334.     popall
  335.     rts
  336.  
  337. *-------------------------------------------------------*
  338. *    Open IWAD file for work                *
  339. *-------------------------------------------------------*
  340. open_wad:
  341. *-------------------------------------------------------*
  342.     movem.l        d1-a6,-(sp)
  343.     tst.w        wad_handle
  344.     bne.s        .open
  345.     Fopen        #iwad_path,#0
  346.     tst.w        d0
  347.     bmi.s        .open
  348.     move.w        d0,wad_handle
  349. .open:    movem.l        (sp)+,d1-a6
  350.     rts
  351.     
  352. *-------------------------------------------------------*
  353. *    Close IWAD if already open            *
  354. *-------------------------------------------------------*
  355. close_wad:
  356. *-------------------------------------------------------*
  357.     movem.l        d1-a6,-(sp)
  358.     tst.w        wad_handle
  359.     beq.s        .close
  360.     Fclose        wad_handle
  361.     clr.w        wad_handle
  362. .close:    movem.l        (sp)+,d1-a6
  363.     rts
  364.  
  365. *-------------------------------------------------------*
  366. *    Print decimal number to TOS console        *
  367. *-------------------------------------------------------*
  368. output_decimal:
  369. *-------------------------------------------------------*
  370.     lea        stringspace,a0
  371.     moveq        #'0',d2
  372.     moveq        #10,d3
  373. .build:    moveq        #0,d5
  374.     divu.l        d3,d5:d0
  375.     add.w        d2,d5
  376.     move.b        d5,-(a0)
  377.     subq.l        #1,d1
  378.     bgt.s        .build
  379.     tst.l        d0
  380.     bne.s        .build
  381.     Cconws        a0
  382.     rts
  383.  
  384. *-------------------------------------------------------*
  385. *    Load & reformat 'things'            *
  386. *-------------------------------------------------------*
  387. things_module:
  388. *-------------------------------------------------------*
  389.     move.l        a0,Thing_Array
  390.     divu.l        #Thing_len,d0
  391.     move.w        d0,NumThings
  392.     move.w        d0,d7
  393.     bra.s        .next_thing    
  394. .thing_loop:
  395.     imov.w        Thing_type(a0),d1
  396.     cmp.w        #1,d1
  397.     bne.s        .no_player
  398.     bsr        .setup_player
  399. .no_player:
  400.     moveq        #(Thing_len/2)-1,d6
  401. .ilp:    imov.w        (a0),(a0)+
  402.     dbra        d6,.ilp
  403. .next_thing:
  404.     dbra        d7,.thing_loop
  405.     rts
  406.  
  407. .setup_player:
  408.     imov.w        Thing_x(a0),px
  409.     imov.w        Thing_y(a0),py
  410.     imov.w        Thing_angle(a0),d1
  411.     swap        d1
  412.     clr.w        d1
  413.     divu.w        #360,d1
  414.     move.w        d1,pangle
  415.     move.w        #40,ph
  416.     rts
  417.  
  418. *-------------------------------------------------------*
  419. *    Load & reformat 'linedefs'            *
  420. *-------------------------------------------------------*
  421. linedefs_module:
  422.     move.l        a0,Line_Array
  423.     divu.l        #Line_len,d0
  424.     move.w        d0,NumLines
  425.     move.w        d0,d7
  426.     bra.s        .next_line
  427. .line_loop:
  428.     moveq        #(Line_len/2)-1,d6
  429. .ilp:    imov.w        (a0),(a0)+
  430.     dbra        d6,.ilp
  431. .next_line:
  432.     dbra        d7,.line_loop
  433.     rts
  434.     
  435. *-------------------------------------------------------*
  436. *    Load & reformat 'sidedefs'            *
  437. *-------------------------------------------------------*
  438. sidedefs_module:
  439. *-------------------------------------------------------*
  440.     move.l        a0,Side_Array
  441.     divu.l        #Side_len,d0
  442.     move.w        d0,NumSides
  443.     move.w        d0,d7
  444.     bra.s        .next_side
  445. .side_loop:
  446.     imov.w        Side_tm_xoff(a0),Side_tm_xoff(a0)
  447.     imov.w        Side_tm_yoff(a0),Side_tm_yoff(a0)
  448.     imov.w        Side_sector(a0),Side_sector(a0)
  449.     lea        Side_len(a0),a0
  450. .next_side:
  451.     dbra        d7,.side_loop
  452.     rts
  453.  
  454. *-------------------------------------------------------*
  455. *    Load & reformat 'vertexes'            *
  456. *-------------------------------------------------------*
  457. vertexes_module:
  458. *-------------------------------------------------------*
  459.     move.l        a0,Vertex_Array
  460.     divu.l        #Vertex_len,d0
  461.     move.w        d0,NumVertices
  462.     move.w        d0,d7
  463.     bra.s        .next_vertex
  464. .vertex_loop:
  465.     moveq        #(Vertex_len/2)-1,d6
  466. .ilp:    imov.w        (a0),(a0)+
  467.     dbra        d6,.ilp
  468. .next_vertex:
  469.     dbra        d7,.vertex_loop
  470.     rts
  471.  
  472. *-------------------------------------------------------*
  473. *    Load & reformat 'segs'                *
  474. *-------------------------------------------------------*
  475. segs_module:
  476. *-------------------------------------------------------*
  477.     move.l        a0,Seg_Array
  478.     divu.l        #Seg_len,d0
  479.     move.w        d0,NumSegs
  480.     move.w        d0,d7
  481.     bra.s        .next_seg
  482. .seg_loop:
  483.     moveq        #(Seg_len/2)-1,d6
  484. .ilp:    imov.w        (a0),(a0)+
  485.     dbra        d6,.ilp
  486. .next_seg:
  487.     dbra        d7,.seg_loop
  488.     rts
  489.  
  490. *-------------------------------------------------------*
  491. *    Load & reformat 'ssectors'            *
  492. *-------------------------------------------------------*
  493. ssectors_module:
  494. *-------------------------------------------------------*
  495.     move.l        a0,SSector_Array
  496.     divu.l        #Ssect_len,d0
  497.     move.w        d0,NumSSectors
  498.     move.w        d0,d7
  499.     bra.s        .next_ssector
  500. .ssector_loop:
  501.     moveq        #(Ssect_len/2)-1,d6
  502. .ilp:    imov.w        (a0),(a0)+
  503.     dbra        d6,.ilp
  504. .next_ssector:
  505.     dbra        d7,.ssector_loop
  506.     rts
  507.  
  508. *-------------------------------------------------------*
  509. *    Load & reformat 'nodes'                *
  510. *-------------------------------------------------------*
  511. nodes_module:
  512. *-------------------------------------------------------*
  513.     move.l        a0,Node_Array
  514.     divu.l        #Node_len,d0
  515.     move.w        d0,NumNodes
  516.     move.w        d0,d7
  517.     bra.s        .next_node
  518. .node_loop:
  519.     moveq        #(Node_len/2)-1,d6
  520. .ilp:    imov.w        (a0),(a0)+
  521.     dbra        d6,.ilp
  522. .next_node:
  523.     dbra        d7,.node_loop
  524.     rts
  525.  
  526. *-------------------------------------------------------*
  527. *    Load & reformat 'sectors'            *
  528. *-------------------------------------------------------*
  529. sectors_module:
  530. *-------------------------------------------------------*
  531.     move.l        a0,Sector_Array
  532.     divu.l        #Sector_len,d0
  533.     move.w        d0,NumSectors
  534.     move.w        d0,d7
  535.     bra.s        .next_sector
  536. .sector_loop:
  537.     imov.w        Sector_floorht(a0),Sector_floorht(a0)
  538.     imov.w        Sector_ceilht(a0),Sector_ceilht(a0)
  539.     imov.w        Sector_light(a0),Sector_light(a0)    
  540.     imov.w        Sector_type(a0),Sector_type(a0)    
  541.     imov.w        Sector_trigger(a0),Sector_trigger(a0)    
  542.     lea        Sector_len(a0),a0
  543. .next_sector:
  544.     dbra        d7,.sector_loop
  545.     rts
  546.  
  547. *-------------------------------------------------------*
  548. *    Load & reformat 'reject'            *
  549. *-------------------------------------------------------*
  550. reject_module:
  551. *-------------------------------------------------------*
  552.     rts
  553.  
  554. *-------------------------------------------------------*
  555. *    Load & reformat 'blockmap'            *
  556. *-------------------------------------------------------*
  557. blockmap_module:
  558. *-------------------------------------------------------*
  559.     rts
  560.  
  561. *-------------------------------------------------------*
  562. *    Generate quick pointer-array for nodes        *
  563. *-------------------------------------------------------*
  564. init_pnodes:
  565. *-------------------------------------------------------*
  566.     moveq        #0,d7
  567.     move.w        NumNodes,d7
  568.     move.l        d7,d1
  569.     subq.l        #1,d7
  570.     move.w        d7,maxnode
  571.     lsl.l        #2,d1
  572.     Malloc        d1
  573.     move.l        d0,PNode_Array
  574.     bgt.s        .memory_ok
  575.     Cconws        #ascii_err_pnodes
  576.     bra        err_closewad
  577. .memory_ok:
  578.     move.l        d0,a1
  579.     move.l        Node_Array,a0
  580. .node_loop:
  581.     move.l        a0,(a1)+
  582.     lea        Node_len(a0),a0
  583.     dbra        d7,.node_loop
  584.     rts
  585.  
  586. *-------------------------------------------------------*
  587. *    Modified strcmp for texture name-searching    *
  588. *-------------------------------------------------------*
  589. strcmp_8:
  590. *-------------------------------------------------------*
  591.     push.l        a0
  592.     push.l        a1
  593.     moveq        #8-1,d2
  594.     moveq        #0,d0
  595. .loop:    swap        d2
  596.     move.b        (a0)+,d3
  597.     beq.s        .term
  598.     fixcase        d3
  599.     move.b        (a1)+,d2
  600.     fixcase        d2
  601.     cmp.b        d2,d3
  602.     bne.s        .diff
  603.     swap        d2
  604.     dbra        d2,.loop
  605.     bra.s        .same
  606. .term:    tst.b        (a1)+
  607.     bne.s        .diff
  608. .same:    moveq        #1,d0
  609. .diff:    pop.l        a1
  610.     pop.l        a0
  611.     rts
  612.  
  613. *-------------------------------------------------------*
  614. *    Miscellaneous error trapping units        *
  615. *-------------------------------------------------------*
  616. *    Can be replaced with generalised error handler    *
  617. *    at some later stage to reduce complexity.    *
  618. *-------------------------------------------------------*
  619.  
  620. *-------------------------------------------------------*
  621. err_fields:
  622. *-------------------------------------------------------*
  623.     Cconws        #ascii_newline
  624.     lea        level_fields,a6
  625.     move.w        #field_count-1,d6
  626. .loop:    move.l        (a6)+,d7
  627.     beq.s        .next
  628.     move.l        d7,a0
  629.     bsr        entry_missing_e
  630. .next:    dbra        d6,.loop
  631.     bra        err_closewad
  632.  
  633. *-------------------------------------------------------*
  634. err_missing:
  635. *-------------------------------------------------------*
  636.     Cconws        #ascii_newline
  637.     move.l        wad_searchfield,a0
  638.     bsr        entry_missing_e
  639.     bra        err_closewad
  640.  
  641. *-------------------------------------------------------*
  642. err_truncated:
  643. *-------------------------------------------------------*
  644.     Cconws        #ascii_newline
  645.     move.l        wad_searchfield,a0
  646.     bsr        entry_truncated
  647.     bra        err_closewad
  648.  
  649. *-------------------------------------------------------*
  650. err_memory:
  651. *-------------------------------------------------------*
  652.     Cconws        #ascii_err_memory
  653.     bra        err_closewad
  654.  
  655. *-------------------------------------------------------*
  656. err_badwad:
  657. *-------------------------------------------------------*
  658.     Cconws        #ascii_err_badwad
  659.     bra        err_closewad
  660.  
  661. *-------------------------------------------------------*
  662. err_openwad:
  663. *-------------------------------------------------------*
  664.     Cconws        #ascii_err_openwad
  665.     bra        err_closewad
  666.  
  667. *-------------------------------------------------------*
  668. err_closewad:
  669. *-------------------------------------------------------*
  670.     bsr        close_wad
  671.     Crawcin
  672.     jmp        safe_quit
  673.  
  674. *-------------------------------------------------------*
  675. entry_missing_w:
  676. *-------------------------------------------------------*
  677.     pushall
  678.     lea        string_space,a1
  679.     move.l        a1,a6
  680.     move.l        (a0)+,(a1)+
  681.     move.l        (a0)+,(a1)+
  682.     clr.b        (a1)
  683.     Cconws        #ascii_err_missing1w
  684.     Cconws        a6
  685.     Cconws        #ascii_err_missing2w
  686.     popall
  687.     rts
  688.  
  689. *-------------------------------------------------------*
  690. entry_missing_e:
  691. *-------------------------------------------------------*
  692.     pushall
  693.     lea        string_space,a1
  694.     move.l        a1,a6
  695.     move.l        (a0)+,(a1)+
  696.     move.l        (a0)+,(a1)+
  697.     clr.b        (a1)
  698.     Cconws        #ascii_err_missing1e
  699.     Cconws        a6
  700.     Cconws        #ascii_err_missing2e
  701.     popall
  702.     rts
  703.  
  704. *-------------------------------------------------------*
  705. entry_truncated:
  706. *-------------------------------------------------------*
  707.     pushall
  708.     lea        string_space,a1
  709.     move.l        a1,a6
  710.     move.l        (a0)+,(a1)+
  711.     move.l        (a0)+,(a1)+
  712.     clr.b        (a1)
  713.     Cconws        #ascii_err_trunc1
  714.     Cconws        a6
  715.     Cconws        #ascii_err_trunc2
  716.     popall
  717.     rts
  718.  
  719. *-------------------------------------------------------*
  720.             datlong
  721. *-------------------------------------------------------*
  722.  
  723. level_fieldlist:    dc.l    ascii_things,things_module    ; list of leveldata resources
  724.             dc.l    ascii_nodes,nodes_module
  725.             dc.l    ascii_sectors,sectors_module
  726.             dc.l    ascii_ssectors,ssectors_module
  727.             dc.l    ascii_segs,segs_module
  728.             dc.l    ascii_linedefs,linedefs_module
  729.             dc.l    ascii_sidedefs,sidedefs_module
  730.             dc.l    ascii_vertexes,vertexes_module
  731.             dc.l    ascii_reject,reject_module
  732.             dc.l    ascii_blockmap,blockmap_module
  733.             dc.l    terminator
  734.  
  735. wad_signature:        ds.l    1                ; IWAD / PWAD signature
  736.             dc.b    0
  737.  
  738. *-------------------------------------------------------*
  739. *    General ASCII messages follow...        *
  740. *-------------------------------------------------------*
  741.     
  742. ascii_signal:        dc.b    13,10,'signal',0
  743. ascii_newline:        dc.b    13,10,0
  744. ascii_startup:        dc.b    27,'E',27,'f',13,10
  745.             dc.b    ' Doom Environment Simulator -> DSP v1.92alpha',13,10,0
  746. ascii_format:        dc.b    13,10
  747.             dc.b    ' WAD class:    ',0
  748. ascii_levelmark:    dc.b    13,10
  749.             dc.b    ' Level marker:    ',0
  750. ascii_reading:        dc.b    13
  751.             dc.b    ' Reading:    ',0
  752. ascii_wipe:        dc.b    '        ',0
  753. ascii_entries:        dc.b    13,10
  754.             dc.b    ' Directories:    ',0
  755. ascii_parsing:        dc.b    13,10
  756.             dc.b    13,10
  757.             dc.b    ' Reading directory structure...',13,10,0 
  758. ascii_parsingdone:    dc.b    13,10
  759.             dc.b    13,10
  760.             dc.b    ' Finished processing leveldata.',13,10,0 
  761.  
  762. ascii_err_missing1e:    dc.b    13,10
  763.             dc.b    ' Missing:    ',0
  764. ascii_err_missing2e:    dc.b    ' -> [error]',0
  765.  
  766. ascii_err_missing1w:    dc.b    13,10
  767.             dc.b    ' Missing:    ',0
  768. ascii_err_missing2w:    dc.b    ' -> [warning]',0
  769.  
  770. ascii_err_trunc1:    dc.b    13,10
  771.             dc.b    ' Truncated:    ',0
  772. ascii_err_trunc2:    dc.b    ' -> [error]',0
  773.  
  774. ascii_err_notex:    dc.b    13,10
  775.             dc.b    ' WAD contains no [textures] -> [warning]',0
  776. ascii_err_noflats:    dc.b    13,10
  777.             dc.b    ' WAD contains no [flats] -> [warning]',0
  778. ascii_err_nopatches:    dc.b    13,10
  779.             dc.b    ' WAD contains no [patches] -> [warning]',0
  780. ascii_err_pnodes:    dc.b    13,10
  781.             dc.b    ' Could not allocate space for [nodes] -> [error]',0
  782. ascii_err_memory:    dc.b    13,10
  783.             dc.b    ' Could not allocate space for [arrays] -> [error]',0
  784. ascii_err_openwad:    dc.b    13,10
  785.             dc.b    ' Could not find & open WAD file -> [error]',0
  786. ascii_err_badwad:    dc.b    13,10
  787.             dc.b    ' This WAD file is not compatible -> [error]',0
  788.  
  789. *-------------------------------------------------------*
  790. *    Leveldata search details            *
  791. *-------------------------------------------------------*
  792.  
  793. ascii_things:        dc.b    'things',0
  794. ascii_linedefs:        dc.b    'linedefs',0
  795. ascii_sidedefs:        dc.b    'sidedefs',0
  796. ascii_vertexes:        dc.b    'vertexes',0
  797. ascii_segs:        dc.b    'segs',0
  798. ascii_ssectors:        dc.b    'ssectors',0
  799. ascii_nodes:        dc.b    'nodes',0
  800. ascii_sectors:        dc.b    'sectors',0
  801. ascii_reject:        dc.b    'reject',0
  802. ascii_blockmap:        dc.b    'blockmap',0
  803. ascii_colormap:        dc.b    'colormap',0
  804. ascii_playpal:        dc.b    'playpal',0
  805.  
  806. *-------------------------------------------------------*
  807.             bsslong
  808. *-------------------------------------------------------*
  809.  
  810. wad_diroffset:        ds.l    1        ; wad search & retrieve variables
  811. wad_entries:        ds.l    1
  812. wad_directory:        ds.l    1
  813. wad_mentries:        ds.l    1
  814. wad_mdirectory:        ds.l    1
  815. wad_searchfield:    ds.l    1
  816. field_ptr:        ds.l    1
  817.  
  818. Seg_Array        ds.l    1        ; leveldata array pointers
  819. Side_Array        ds.l    1
  820. Line_Array        ds.l    1
  821. Node_Array        ds.l    1
  822. PNode_Array        ds.l    1
  823. Sector_Array        ds.l    1
  824. Vertex_Array        ds.l    1
  825. SSector_Array        ds.l    1
  826. Thing_Array        ds.l    1
  827.  
  828. colormap_ptr:        ds.l    1        ; palette & colourmap pointers
  829. playpal_ptr:        ds.l    1
  830.  
  831. level_fields:        ds.l    field_count+1    ; space for level search information
  832.  
  833. wad_header:        ds.b    wh_len        ; space for wad header
  834. wad_handle:        ds.w    1        ; IWAD handle
  835.  
  836. fields_left:        ds.w    1        ; leveldata field count
  837.  
  838. NumThings:        ds.w    1        ; various array sizes
  839. NumSegs:        ds.w    1
  840. NumLines:        ds.w    1
  841. NumSides:        ds.w    1
  842. NumVertices:        ds.w    1
  843. NumSSectors:        ds.w    1
  844. NumNodes:        ds.w    1
  845. NumSectors:        ds.w    1
  846.  
  847. *-------------------------------------------------------*
  848.             txtlong
  849. *-------------------------------------------------------*
  850.  
  851.